/*
 * Copyright 2011 Katsunori Koyanagi
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package sweezy.core.log
{

	internal class LoggerImpl implements ILogger
	{

		internal var _category:String;

		internal var _name:String;

		public function LoggerImpl(category:String, name:String)
		{
			_category = category;
			_name = name;
		}

		public function get category():String
		{
			return _category;
		}

		public function debug(message:String, ... args):void
		{
			Logger.write(LogLevel.DEBUG, this, message, args);
		}

		public function get debugEnabled():Boolean
		{
			return Logger.isEnabled(LogLevel.DEBUG, _category);
		}

		public function error(message:String, ... args):void
		{
			Logger.write(LogLevel.ERROR, this, message, args);
		}

		public function get errorEnabled():Boolean
		{
			return Logger.isEnabled(LogLevel.ERROR, _category);
		}

		public function fatal(message:String, ... args):void
		{
			Logger.write(LogLevel.FATAL, this, message, args);
		}

		public function get fatalEnabled():Boolean
		{
			return Logger.isEnabled(LogLevel.FATAL, _category);
		}

		public function info(message:String, ... args):void
		{
			Logger.write(LogLevel.INFO, this, message, args);
		}

		public function get infoEnabled():Boolean
		{
			return Logger.isEnabled(LogLevel.INFO, _category);
		}

		public function get name():String
		{
			return _name;
		}

		public function warn(message:String, ... args):void
		{
			Logger.write(LogLevel.WARN, this, message, args);
		}

		public function get warnEnabled():Boolean
		{
			return Logger.isEnabled(LogLevel.WARN, _category);
		}
	}
}
